package com.lyncs.ods.modules.txn.model;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.lyncs.ods.constant.TagInfoEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @author alex
 * @date 2022/5/8 23:59
 * @description
 */
@Data
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@NoArgsConstructor
public class TagInfo {
    /**
     * code
     */
    private String code;
    /**
     * level
     */
    private String level;
    /**
     * desc
     */
    private String desc;
    /**
     * frozen
     */
    private Boolean frozen;
    /**
     * group
     */
    private String group;
    /**
     * priority
     */
    private Integer priority;

    public TagInfo(TagInfoEnum tagInfoEnum) {
        this.code = tagInfoEnum.getCode();
        this.level = tagInfoEnum.getLevel();
        this.desc = tagInfoEnum.getDesc();
        this.frozen = tagInfoEnum.getFrozen();
        this.group = tagInfoEnum.getGroup();
        this.priority = tagInfoEnum.getPriority();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TagInfo tagInfo = (TagInfo) o;
        return Objects.equals(code, tagInfo.code);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code);
    }
}
